package com.sms.graduate.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sms.graduate.dao.SmsDictionaryDao;
import com.sms.graduate.entity.SmsDictionary;
import com.sms.graduate.service.SmsDictionaryService;
import org.springframework.stereotype.Service;


@Service
public class SmsDictionaryServiceImpl extends ServiceImpl<SmsDictionaryDao, SmsDictionary> implements SmsDictionaryService {

    @Override
    public String selectClass(String code, Integer scope) {
        QueryWrapper<SmsDictionary> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(SmsDictionary.COL_CODE,code)
                .eq(SmsDictionary.COL_SCOPE,scope);
        SmsDictionary smsDictionary = this.getOne(queryWrapper);
        return smsDictionary.getValue();
    }

    @Override
    public String selectCode(String value, Integer scope) {
        QueryWrapper<SmsDictionary> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(SmsDictionary.COL_VALUE,value)
                .eq(SmsDictionary.COL_SCOPE,scope);
        SmsDictionary smsDictionary = this.getOne(queryWrapper);
        return smsDictionary.getCode();
    }
}

